package org.tema.entities;

import java.io.Serializable;
import javax.persistence.*;

/**
 * Entity implementation class for Entity: Report
 *
 */
@Entity
@Table(name="REPORT")
public class Report implements Serializable {

	
	private int id;
	private int passed;
	private int failed;
	private int blocked;
	private double plannedExecTime;
	private double actualExecTime;
	private int notExecuted;
	private double passRatio;
	private double failRatio;
	private static final long serialVersionUID = 1L;
	
	/* Add relational properties for TestSpecification, Testers, TestCases, TestPlans;
	   Reports relationship has been removed because the report is per TestPlan run, Specification
	   if a report's generated for a product not clear for what run an what specification.
	   Appropriate searches need to be added at business layer.
	*/
	private TestSpecification specification;
	private TestPlan plan;

	public Report() {
		super();
	}
	
	@Id    
	@GeneratedValue
	@Column(name="ID")
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	} 
	
	@Column(name="PASSED")
	public int getPassed() {
		return this.passed;
	}

	public void setPassed(int passed) {
		this.passed = passed;
	}  
	
	@Column(name="FAILED")
	public int getFailed() {
		return this.failed;
	}

	public void setFailed(int failed) {
		this.failed = failed;
	}  
	
	@Column(name="BLOCKED")
	public int getBlocked() {
		return this.blocked;
	}

	public void setBlocked(int blocked) {
		this.blocked = blocked;
	}  
	
	@Column(name="PLANNEDEXECTIME")
	public double getPlannedExecTime() {
		return this.plannedExecTime;
	}

	public void setPlannedExecTime(double plannedExecTime) {
		this.plannedExecTime = plannedExecTime;
	}  
	
	@Column(name="ACTUALEXECTIME")
	public double getActualExecTime() {
		return this.actualExecTime;
	}

	public void setActualExecTime(double actualExecTime) {
		this.actualExecTime = actualExecTime;
	}  
	
	@Column(name="NOTEXECUTED")
	public int getNotExecuted() {
		return this.notExecuted;
	}

	public void setNotExecuted(int notExecuted) {
		this.notExecuted = notExecuted;
	} 
	
	@Column(name="PASSRATIO")
	public double getPassRatio() {
		return this.passRatio;
	}

	public void setPassRatio(double passRatio) {
		this.passRatio = passRatio;
	}   
	
	@Column(name="FAILRATIO")
	public double getFailRatio() {
		return this.failRatio;
	}

	public void setFailRatio(double failRatio) {
		this.failRatio = failRatio;
	}

	
	//reference to test specification, the report cannot exist without a specification for which to be generated
	@OneToOne( cascade= {CascadeType.PERSIST, CascadeType.MERGE },  optional= false )
	@JoinColumn(name="SPECIFICATION_ID", referencedColumnName = "ID")
	public TestSpecification getSpecification() {
		return specification;
	}

	public void setSpecification(TestSpecification specification) {
		this.specification = specification;
	}

	//reference to test plan, the report cannot exist without a specification for which to be generated
	@OneToOne(  cascade= {CascadeType.PERSIST, CascadeType.MERGE }, optional= false )
	@JoinColumn(name="PLAN_ID", referencedColumnName = "ID")
	public TestPlan getPlan() {
		return plan;
	}

	public void setPlan(TestPlan plan) {
		this.plan = plan;
	}
   
}
